// 导入基础库
import { connect, history } from 'umi'

// 导入处理函数
import { filter_file } from './methods'


export const file_view = (props) => {
    const { global: state, dispatch } = props
    const file_id = props.match.params.file

    var fv = []
    if (state.list_all.length !== 0) {
        fv = filter_file(state.list_all, '_id', file_id)
    }
    console.log(fv)

    return (
        <div>
            {state.table_cols.map((key, id) =>
                <p key={id}>{key.title}：{fv[key.key] ? fv[key.key] : '-'}</p>
            )}
        </div>
    )
}


// 导出组件UI并绑定Models
export default connect(({ global }) => ({ global }))(file_view);